package com.sunday.player.domain;

import java.io.Serializable;

import android.database.Cursor;
import android.os.Parcel;
import android.os.Parcelable;
import android.provider.MediaStore.Audio.AudioColumns;


/**
 * 뮤직데이타 저장용
 * @author user
 *
 */
public class musicData extends basicdomain implements Serializable ,Parcelable {
    /**
     * 
     */
    private static final long serialVersionUID = 8047929614756385331L;
    
    
    private String _id; // ID
    private String _display_name; // 파일이름
    private String title;// 음악이름
    private int 	trackno; // 앨범 트랙넘버 
    private String duration;
    private String album_id;
    private String album;
    private String artist_id;
    private String artist;
    private String Listid;
    private String year;
    private String _data;
    private String Url;
    private int count;
    
    public musicData(String path , String title , String artist , String album) {
	this._data = path;
	this.title = title;
	this.artist = artist;
	this.album = album;
    }
    public musicData(String path , String title , String artist  ) {
   	this._data = path;
   	this.title = title;
   	this.artist = artist;
   }
    /**
     * AudioColumns._ID,
	AudioColumns.DATA,        // 풀패스 
	AudioColumns.DISPLAY_NAME, // 파일이름
	AudioColumns.TITLE,
	AudioColumns.DURATION,
	AudioColumns.ALBUM_ID,
	AudioColumns.ALBUM,
	AudioColumns.TRACK,   // 트랙넘버 
	AudioColumns.YEAR,
	AudioColumns.ARTIST_ID,
	AudioColumns.ARTIST,
     * @param c
     */
    public musicData(Cursor c) {
	_id = c.getString(0);
	_data = c.getString(1);
	_display_name = c.getString(2);
	title  = c.getString(3);
	duration   = c.getString(4);
	album_id  = c.getString(5);
	album  = c.getString(6);
	trackno  = c.getInt(7);
	year  = c.getString(8);
	artist_id = c.getString(9);
	artist  = c.getString(10);
	count = 0;
    }
    public musicData(Cursor c , String listId){
	_id = c.getString(0);
	listId = c.getString(1);
	title  = c.getString(2);
	trackno  = c.getInt(3);
	duration   = c.getString(4);
	album_id  = c.getString(5);
	album  = c.getString(6);
	artist_id = c.getString(7);
	artist  = c.getString(8);
	_data = c.getString(9);
	count = c.getInt(10);
	setUrl(c.getString(11));
	
	_display_name = c.getString(2);
	year  = c.getString(8);
	
	
	
	
    }
   
    public static Parcelable.Creator<musicData> CREATOR = new Parcelable.Creator<musicData>() {

	@Override
	public musicData createFromParcel(Parcel source) {
	    // TODO Auto-generated method stub
	    return new musicData(source);
	}

	@Override
	public musicData[] newArray(int size) {
	    // TODO Auto-generated method stub
	    return new musicData[size];
	}
    };
    public musicData(Parcel source) {
	_id = source.readString();
	title = source.readString();
	trackno = source.readInt();
	duration = source.readString();
	album_id = source.readString();
	album = source.readString();
	artist_id = source.readString();
	artist = source.readString();
	count = source.readInt();
    }
    
    @Override
    public void writeToParcel(Parcel dest, int flags) {
	dest.writeString(_id);
	dest.writeString(title);
	dest.writeInt(trackno);
	dest.writeString(duration);
	dest.writeString(album_id);
	dest.writeString(album);
	dest.writeString(artist_id);
	dest.writeString(artist);
	dest.writeString(_data);
	dest.writeInt(count);
	
    }
    
    public int getCount() {
        return count;
    }
    public void setCount(int count) {
        this.count = count;
    }
    public String get_id() {
        return _id;
    }
    public void set_id(String _id) {
        this._id = _id;
    }
    public String getTitle() {
        return title;
    }
    public void setTitle(String title) {
        this.title = title;
    }
    public int getTrack() {
        return trackno;
    }
    public void setTrack(int track) {
        this.trackno = track;
    }
    public String getDuration() {
        return duration;
    }
    public void setDuration(String duration) {
        this.duration = duration;
    }
    public String getAlbum_id() {
        return album_id;
    }
    public void setAlbum_id(String album_id) {
        this.album_id = album_id;
    }
    public String getAlbum() {
        return album;
    }
    public void setAlbum(String album) {
        this.album = album;
    }
    public String getArtist_id() {
        return artist_id;
    }
    public void setArtist_id(String artist_id) {
        this.artist_id = artist_id;
    }
    public String getArtist() {
        return artist;
    }
    public void setArtist(String artist) {
        this.artist = artist;
    }
    public String get_data() {
        return _data;
    }
    public void set_data(String _data) {
        this._data = _data;
    }
    @Override
    public int describeContents() {
	// TODO Auto-generated method stub
	return 0;
    }
    public String getListid() {
	return Listid;
    }
    public void setListid(String listid) {
	Listid = listid;
    }
    public String getUrl() {
	return Url;
    }
    public void setUrl(String url) {
	Url = url;
    }
   
    
}
